﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ListenMusic.Friend_ServiceReference;

using System.ServiceModel;

namespace ListenMusic.Models.Reposistory.User
{
    public class FriendResposistory
    {
        FriendServiceClient friendClient = new FriendServiceClient();
        public List<FriendUserAB> getFriendByUser(string username)
        {
            try
            {
                friendClient.ClientCredentials.UserName.UserName = "clientuser";
                friendClient.ClientCredentials.UserName.Password = "123456";
                FriendUserAB[] lstfriend = friendClient.getFriendsByUser(username);
                return lstfriend.ToList();
            }
            catch (FaultException ex)
            {
                throw ex;
            }
        }
        public bool AddFriend(Friend f)
        {
            try
            {
                friendClient.ClientCredentials.UserName.UserName = "clientuser";
                friendClient.ClientCredentials.UserName.Password = "123456";
                return friendClient.AddFriend(f);
            }
            catch (FaultException ex)
            {
                throw ex;
            }
        }
        
    }
}